#include "ServerUdp.hpp"

#include "Dictionary.hpp"

//./server_udp port
int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        std::cerr << "Use error, Please use on ./server_udp port" << std::endl;
        DIE(1);
    }

    uint16_t port =std::stoi(argv[1]);
    std::shared_ptr<Dictionary> dictionary= std::make_shared<Dictionary>();
    std::shared_ptr<Server_Udp> server_ptr = std::make_shared<Server_Udp>([&dictionary](const std::string& word) \
                                                                        {return dictionary->TransLate(word);}
                                                                        ,port);
    server_ptr->InitSocket();
    server_ptr->Start();
    return 0;
}